﻿using System;
using System.Drawing;
using System.Windows.Forms;
using DR = System.Drawing;
using WF = System.Windows.Forms;

namespace UpwardsTimeClock.Prototype
{
    public class LabelControl : VisualControlBase<Label>
    {
        private WF.Label _label;

        public static WF.Label CreateLabel(Label config)
        {
            WF.Label label = new WF.Label();
            label.Top = 0;
            label.Left = 0;
            label.BackColor = Color.FromName(config.BackColor);
            label.ForeColor = Color.FromName(config.ForeColor);
            label.Font = new Font(
                config.Font,
                config.FontSize,
                (DR.FontStyle)Enum.Parse(typeof(DR.FontStyle), config.FontStyle.ToString()));
            label.AutoSize = false;
            label.TextAlign = ContentAlignment.MiddleCenter;

            return label;
        }

        public LabelControl(Label config): base(config)
        {
            _label = CreateLabel(config);
            _label.Text = config.Text;
        }

        protected override Control CreateVisualControl()
        {
            return _label;
        }
    }
}
